use "$input/yu_ash_ready", clear

* use data after 1965

eststo clear
keep if year >= 1965

eststo: reghdfe cites_pos_m_log   polar_start if rule_P, absorb(stateyear) cluster(state year)
outreg2 using "$output/tables/tab1", excel replace se alpha(0.01, 0.05, 0.1) symbol(**, *, +) addtext(Court-year FE, X) addstat(Adjusted R-squared,  e(r2_a)) nocons nor2 nonotes

// add starting decade FEs
eststo: reghdfe cites_pos_m_log   polar_start if rule_P, absorb(stateyear x_decade_start) cluster(state year)
outreg2 using "$output/tables/tab1", excel append se alpha(0.01, 0.05, 0.1) symbol(**, *, +) addtext(Court-year FE, X, Cohort FE, X) addstat(Adjusted R-squared,  e(r2_a)) nocons nor2 nonotes

// state-specific starting-year trends
eststo: reghdfe cites_pos_m_log   polar_start if rule_P, absorb(stateyear i.statefe#c.x_year_start x_decade_start) cluster(state year)
outreg2 using "$output/tables/tab1", excel append se alpha(0.01, 0.05, 0.1) symbol(**, *, +) addtext(Court-year FE, X, Cohort FE, X, StatexStart-year,X) addstat(Adjusted R-squared,  e(r2_a)) nocons nor2 nonotes

// state-specific starting-year trends: random only
eststo: reghdfe cites_pos_m_log   polar_start if rule_P & rule_rand_assign==1, absorb(stateyear i.statefe#c.x_year_start x_decade_start) cluster(state year)
outreg2 using "$output/tables/tab1", excel append se alpha(0.01, 0.05, 0.1) symbol(**, *, +) addtext(Court-year FE, X, Cohort FE, X, StatexStart-year,X, Rand Only, X) addstat(Adjusted R-squared,  e(r2_a)) nocons nor2 nonotes


// case controls
eststo: reghdfe cites_pos_m_log pca_*  polar_start if rule_P, absorb(stateyear i.statefe#c.x_year_start x_decade_start) cluster(state year)
outreg2 using "$output/tables/tab1", keep(polar_start) excel append se alpha(0.01, 0.05, 0.1) symbol(**, *, +) addtext(Court-year FE, X, Cohort FE, X, StatexStart-year,X,Case Controls, X) addstat(Adjusted R-squared,  e(r2_a)) nocons nor2 nonotes


// judge experience control
eststo: reghdfe cites_pos_m_log pca_* polar_start x_topschool x_female x_democrat x_republican x_topschool_missing if rule_P, absorb(stateyear i.statefe#c.x_year_start x_decade_start exper5) cluster(state year)
outreg2 using "$output/tables/tab1", excel append se alpha(0.01, 0.05, 0.1) symbol(**, *, +) addtext(Court-year FE, X, Cohort FE, X, StatexStart-year,X,Case Controls, X, Experience FEs, X) addstat(Adjusted R-squared,  e(r2_a)) nocons nor2 nonotes keep(polar_start x_topschool x_female x_democrat x_republican)
